package org.xuk.spring.ws.web;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xuk.spring.ws.model.BoardCastMessage;
import org.xuk.spring.ws.model.SingleMessage;
import org.xuk.spring.ws.service.MessageSendService;

@RestController
@Slf4j
@RequestMapping("/api/ws/message")
@Api("消息发送")
public class MessageController {
    private final MessageSendService messageSendService;

    public MessageController(MessageSendService messageSendService) {
        this.messageSendService = messageSendService;
    }

    @PostMapping("/single/send")
    public Boolean singleSend(@RequestBody SingleMessage singleMessage) {
        return messageSendService.singleSend(singleMessage);
    }

    @PostMapping("/boardCast/send")
    public Boolean boardCastSend(@RequestBody BoardCastMessage boardCastMessage) {
        return messageSendService.boardCastSend(boardCastMessage);
    }

}
